package com.caocaog.market.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 会员信息
 *
 * @author chechen
 * @date 2021-11-19
 */
@Data
@TableName("mk_member_basic")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "mk_member_basic对象", description = "会员信息")
public class Member implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "ID")
    private String id;

    @ApiModelProperty(value = "创建人")
    private String createBy;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新人")
    private String updateBy;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @TableField(update = "%s+1")
    @ApiModelProperty(value = "版本号")
    private Integer lockVersion;

    @Dict(dicCode = "mk_whether")
    @TableLogic
    @ApiModelProperty(value="是否删除")
    private Integer delFlag;

    @ApiModelProperty(value = "用户名",notes = "user_{id}")
    private String userName;

    @ApiModelProperty(value = "登录名",notes = "手机号")
    private String loginName;

    @ApiModelProperty(value = "密码")
    private String userPwd;

    @ApiModelProperty(value = "手机号")
    private String mobile;

    @Dict(dicCode = "member_status")
    @ApiModelProperty(value = "状态 0正常 1冻结")
    private Integer status;

    @ApiModelProperty(value = "微信openid")
    private String wxOpenid;

    @ApiModelProperty(value = "微信unionid")
    private String wxUnionid;

    @ApiModelProperty(value = "小程序openid")
    private String xcxOpenid;

    @ApiModelProperty(value = "微信昵称")
    private String nickName;

    @ApiModelProperty(value = "微信头像")
    private String avatar;

    @ApiModelProperty(value = "用户姓名",notes = "用户自己更新的")
    private String name;

    @Dict(dicCode = "sex")
    @ApiModelProperty(value = "性别")
    private Integer sex;

    @Dict(dicCode = "member_source")
    @ApiModelProperty(value = "来源 1ios 2android 3微信小程序(ccll) 4微信小程序(送大侠) ")
    private Integer source;

    @ApiModelProperty(value = "所属分站id")
    private String siteId;

    @ApiModelProperty(value = "注册分站id")
    private String siteIdRegist;

    @ApiModelProperty(value = "注册经度")
    private String registLat;

    @ApiModelProperty(value = "注册纬度")
    private String registLng;

    @ApiModelProperty(value = "下单次数")
    private Integer orderQty;

    @ApiModelProperty(value = "订单总额")
    private String orderAnt;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "最后下单时间")
    private Date orderLast;

    /**
     * md5密码盐
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    @ApiModelProperty(value="密码加密所用到的密码盐")
    private String salt;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(hidden = true)
    private transient LocalDate createDateFrom;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(hidden = true)
    private transient LocalDate createDateTo;
    @ApiModelProperty(hidden = true)
    private transient String siteName;

    @ApiModelProperty(value = "个人积分")
    private BigDecimal point;
}
